<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>SUBX Instruction</title>
<link href="../edit68k.css" rel="stylesheet" type="text/css">
</head>

<body>
<h1 class="heading">SUBX Instruction<BR>
</h1>
<hr noshade></h1>
<BR>
<span class="text">The instruction SUBX (SUBtract eXtended) works the same as SUB but the X flag is also subtracted. This makes it possible to add big numbers stored in many bytes (multi-precision).<BR>
<BR>
This instruction has two methods:<BR>
<BR>
1. Subtract a data register from a data register.<BR>
2. Subtract a memory location to another memory location. You must use -(An) on both operands then.<BR>
<BR>
ADDRESS METHODS: Dn, -(An)<BR>
<BR>
DATA LENGTH: Byte, word, longword</span>
<br>
<br>          
<TABLE border=0 cellPadding=0 cellSpacing=0 width="75%">
  <TBODY>
    <TR>
      <TD width="17%" rowSpan=5 vAlign=top class="text">FLAGS:</TD>
      <TD width="83%" class="text">X - Set if a loan was required from the most significant bit, else 0.</TD>
    </TR>
    <TR>
      <TD width="83%" class="text">N - S</TD>
    </TR>
    <TR>
      <TD width="83%" class="text">Z - Cleared if the result is not zero, else unaffected</TD>
    </TR>
    <TR>
      <TD width="83%" class="text">C - Same as X</TD>
    </TR>
    <TR>
      <TD width="83%" class="text">V - S</TD>
    </TR>
  </TBODY>
</TABLE>
<P class="text">The Z flag works in another way now, making it possible to check if a big number (much bigger than 32 bits) is zero. You must set the zero flag before making the addition though, shorter than comparing a register with itself.</P>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="77%">
  <TBODY>
    <TR>
      <TD width="19%" rowSpan=2 class="text">SYNTAX:</TD>
      <TD width="81%" class="text">SUBX Dy,Dx</TD>
    </TR>
    <TR>
      <TD width="81%" class="text">SUBX -(Ay),-(Ax)</TD>
    </TR>
  </TBODY>
</TABLE>
<P class="text">EXAMPLE CODE:</P>
<P class="sourcecode"><font face="Arial" size="2">&nbsp;&nbsp;&nbsp; SUBX.B&nbsp;&nbsp;&nbsp; D0,D1&nbsp;&nbsp;&nbsp; 
D1 = D1 - D0 - X</font></P>
</body>
</html>